<?php
namespace Cyfy\Modules\jquery;

class Plugins
{
    
	// loaded extensions
    static private $loaded = array();
    
	/**
	 * Loads a specified extension.
	 *
	 * @param string $extension Name of the extension.
	 * @return bool True, if load successfull.
	 */
    static function load($extension)
	{
        // is the extension loaded?
        if (!in_array($extension, self :: $loaded))
		{
			$filename = "Cyfy/Modules/{$extension}/jquery.plugin.php";
			
            if(!file_exists($filename))
			{
				\Cyfy\Log :: write("jquery plugin {$extension} not found");
				return false;
			}
            
            include_once($filename);
            self :: $loaded[] = $extension;
		}
		return true;
    }    
}